package com.example.courier.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.example.courier.entity.Location;
import com.example.courier.mapper.LocationMapper;
import com.example.courier.model.resp.LocationVO;
import com.example.courier.service.LocationService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2025/9/6 16:23
 **/
@Service
@RequiredArgsConstructor
public class LocationServiceImpl implements LocationService {

    private final LocationMapper locationMapper;

    @Override
    public List<LocationVO> getLocationList() {
        List<Location> locations = locationMapper.queryLocationList();
        return locations.stream().map(location -> BeanUtil.toBean(location, LocationVO.class)).toList();

    }
}
